<?php
namespace prog_index\lib {
    \defined( '_JEXEC' ) or die( 'Restricted access' );

    /**
     * Description of Controller
     *
     * @author George Zeakis<zeageorge@google.com>
     */
    abstract class Controller {
        protected $_vars = array();
        
        final public function __construct() {
            
            $this->_vars["className"]  = __CLASS__;
            $this->_vars["childClass"] = \get_called_class();
            
            if (func_num_args()>0){
                $ar = func_get_arg(0);
                if (is_array($ar)){ foreach ($ar as $key => $value) { $this->{$key} = $value; } }
            }
            
            // todo:
            // load the View if it exists
            // load the Model if it exists
            // 
            // $this->view = new View();
        }

//        final public function loadModel($name) {
//                $path = MODELS.$name.'_model.php';
//                if (file_exists($path)) {
//                    require $path;
//                    $modelName = $name . '_Model';
//                    $this->model = new $modelName();
//                    return true;
//                } else {
//                    return false;
//                }		
//        }
        
        final public function __destruct() { }
    }
}
?>
